package com.jt.tenant.conn;


import com.jt.tenant.app.JTApplication;
import com.zcx.helper.http.AsyCallBack;
import com.zcx.helper.http.note.HttpInlet;
import org.json.JSONObject;

/**
 * Created by DR on 2016/3/4.
 */
@HttpInlet(Conn.INLET_EDIT_BATTERY_BUY_TIME)
public class GetEditBatteryBuyTime extends JTAsyGet<GetEditBatteryBuyTime.Info> {

    public String token = JTApplication.jtPreferences.readToken();

    public String battery_buy_time;

    public GetEditBatteryBuyTime(String battery_buy_time, AsyCallBack<Info> asyCallBack) {
        super(asyCallBack);
        this.battery_buy_time = battery_buy_time;
    }

    @Override
    protected Info parser(JSONObject object) {

        JSONObject apiTYF = object.optJSONObject("apiTYF");
        JSONObject head = apiTYF.optJSONObject("head");
        Info info = new Info();
        info.msg = head.optString("msg");
        info.code = head.optString("code");
        JSONObject body = apiTYF.optJSONObject("body");

        return info.msg.equals("000") ? info : null;
    }

    public static class Info {
        public String msg, code;
//        public String per, remainTime, flameoutLastTime, batteryRemain, batteryPie, batteryStatus;
    }
}
